import {adminRequest} from "@/utils/request.ts";
import type {
    ApiResponse, CoachAgeDistribution, CoachGenderDistribution, ConsumptionRanking, ConsumptionTypeDistribution,
    CourseRevenueData, CourseSalesData,
    DashboardData, EquipmentStatusDistribution, EquipmentTypeDistribution,
    MemberTypeDistribution
} from "@/type/statistics.ts";

enum API {
    // 仪表盘数据
    GET_DASHBOARD_DATA = '/admin/statistics/dashboard',

    // 会员统计
    GET_MEMBER_TYPE_DISTRIBUTION = '/admin/statistics/member-type-distribution',

    // 课程统计
    GET_COURSE_SALES = '/admin/statistics/course-sales',
    GET_COURSE_REVENUE = '/admin/statistics/course-revenue',

    // 消费统计
    GET_CONSUMPTION_TYPE_DISTRIBUTION = '/admin/statistics/consumption-type-distribution',
    GET_CONSUMPTION_RANKING = '/admin/statistics/consumption-ranking',

    // 设备统计
    GET_EQUIPMENT_STATUS_DISTRIBUTION = '/admin/statistics/equipment-status-distribution',
    GET_EQUIPMENT_TYPE_DISTRIBUTION = '/admin/statistics/equipment-type-distribution',

    // 教练统计
    GET_COACH_GENDER_DISTRIBUTION = '/admin/statistics/coach-gender-distribution',
    GET_COACH_AGE_DISTRIBUTION = '/admin/statistics/coach-age-distribution',
}

// 仪表盘数据
export const reqDashboardData = () =>
    adminRequest.get<any, ApiResponse<DashboardData>>(API.GET_DASHBOARD_DATA)

// 会员类型分布
export const reqMemberTypeDistribution = () =>
    adminRequest.get<any, ApiResponse<MemberTypeDistribution[]>>(API.GET_MEMBER_TYPE_DISTRIBUTION)

// 课程销量
export const reqCourseSales = () =>
    adminRequest.get<any, ApiResponse<CourseSalesData[]>>(API.GET_COURSE_SALES)

// 课程收入
export const reqCourseRevenue = () =>
    adminRequest.get<any, ApiResponse<CourseRevenueData[]>>(API.GET_COURSE_REVENUE)

// 消费类型分布
export const reqConsumptionTypeDistribution = () =>
    adminRequest.get<any, ApiResponse<ConsumptionTypeDistribution[]>>(API.GET_CONSUMPTION_TYPE_DISTRIBUTION)

// 会员消费排行榜
export const reqConsumptionRanking = () =>
    adminRequest.get<any, ApiResponse<ConsumptionRanking[]>>(API.GET_CONSUMPTION_RANKING)

// 设备状态分布
export const reqEquipmentStatusDistribution = () =>
    adminRequest.get<any, ApiResponse<EquipmentStatusDistribution[]>>(API.GET_EQUIPMENT_STATUS_DISTRIBUTION)

// 设备类型分布
export const reqEquipmentTypeDistribution = () =>
    adminRequest.get<any, ApiResponse<EquipmentTypeDistribution[]>>(API.GET_EQUIPMENT_TYPE_DISTRIBUTION)

// 教练性别分布
export const reqCoachGenderDistribution = () =>
    adminRequest.get<any, ApiResponse<CoachGenderDistribution[]>>(API.GET_COACH_GENDER_DISTRIBUTION)

// 教练年龄分布
export const reqCoachAgeDistribution = () =>
    adminRequest.get<any, ApiResponse<CoachAgeDistribution[]>>(API.GET_COACH_AGE_DISTRIBUTION)